#!/bin/bash
OK=0
WARN=1
CRITICAL=2
UNKNOWN=3
PATH="/bin:/sbin:/usr/bin:/usr/sbin"

host_name=`/bin/hostname -s`
Judge=0

function echobinfile() {
                echo b | /usr/bin/sudo /usr/bin/tee /proc/sysrq-trigger  1>/dev/null 2>&1

                if [ $? != 0  ]
                then
                        Judge=1
                        Fail_name="${host_name} echo b failed"
		else
			Ok_name="${host_name} echo b success"
                fi
}

echobinfile

if [ $Judge -eq 1 ]
then
	echo "$Fail_name"
	exit $CRITICAL
else
	echo "$Ok_name"
	exit $OK
fi


